package gui.components;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

import javax.swing.JPanel;

public class ImageComponent extends JPanel{
  private static final long serialVersionUID = 1L;
  
	private BufferedImage image;
	private int width;
	private int height;
	
	public ImageComponent(BufferedImage image, int width, int height){
		this.image = image;
		this.width = width;
		this.height = height;
		setPreferredSize(new Dimension(width, height));
		setOpaque(false);
	}

	@Override
  public void paintComponent(Graphics g) {
		g.setColor(Color.BLACK);
		g.fillRect(width / 2 - image.getWidth() / 2, height / 2 - image.getHeight() / 2, 40, 40);
		g.drawImage(image, 0, 0, null);
  }
	
	
}
